Data Science for Business With R by Jeffrey S. Saltz & Jeffrey M. Stanton
Author:Jeffrey S. Saltz & Jeffrey M. Stanton
Language: eng
Format: epub
Published: 2021-02-14T20:34:49.612924+00:00
You can see we saved the visualization in a variable ("g"), so we can add another layer. Letâs use that stored visualization variable and add some labeling to show the name of each state. Note that we defined some additional aesthetics for the text (the size, and the vertical adjustment of where to place the text).
g + geom_text(size=3, vjust=2) + aes(label=stateName)
By examining this scatterplot, we see that some states are outliers (some have large populations and some have much smaller populations). For example, the District of Columbia has a very small population and a small absolute population change, but has the largest percent increase in population. Texas is a very large state and has both a high absolute and high percentage increase in population.
This chart has now become very cluttered. Letâs clean it up by doing several actions. First, letâs define a set of key (or important) states. These are the states that have a percentage change of at least 1% and a population change of at least 100,000 people. With these criteria, we define a new column in the dfStates dataframe, keyState, to be true if that state fits our defined criteria of percentage and population change. In the scatter chart, we show the key states by defining the shape of the symbol within the scatterplot to dependent on the keyState column. We also only show the text for the key states. Next, we clean up the format of the color key, defining the three values to be shown in the key as well as formatting the numbers to include commas, so the numbers are easier to see. Finally, we change the color scale to range from white to black.
#define the criteria to show the text for the state
minPerChange <- 1
minPopChange <- 100000
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(8310)
Azure Data and AI Architect Handbook by Olivier Mertens & Breght Van Baelen(6826)
Building Statistical Models in Python by Huy Hoang Nguyen & Paul N Adams & Stuart J Miller(6805)
Serverless Machine Learning with Amazon Redshift ML by Debu Panda & Phil Bates & Bhanu Pittampally & Sumeet Joshi(6690)
Data Wrangling on AWS by Navnit Shukla | Sankar M | Sam Palani(6479)
Driving Data Quality with Data Contracts by Andrew Jones(6431)
Machine Learning Model Serving Patterns and Best Practices by Md Johirul Islam(6178)
Learning SQL by Alan Beaulieu(6006)
Weapons of Math Destruction by Cathy O'Neil(5800)
Big Data Analysis with Python by Ivan Marin(5405)
Data Engineering with dbt by Roberto Zagni(4413)
Solidity Programming Essentials by Ritesh Modi(4061)
Time Series Analysis with Python Cookbook by Tarek A. Atwan(3921)
Pandas Cookbook by Theodore Petrou(3626)
Blockchain Basics by Daniel Drescher(3308)
Hands-On Machine Learning for Algorithmic Trading by Stefan Jansen(2914)
Feature Store for Machine Learning by Jayanth Kumar M J(2822)
Learn T-SQL Querying by Pam Lahoud & Pedro Lopes(2804)
Mastering Python for Finance by Unknown(2748)
